<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script>
    const htmlEl = document.documentElement

    function resetFontSize() {
      const screenWidth = htmlEl.clientWidth
      const fz = screenWidth/10
      htmlEl.style.fontSize = fz+'px'
      console.log(fz);
      
    }
    resetFontSize()
    window.addEventListener('resize',resetFontSize)
  </script>
  <style>
    body{
      margin: 0;
      padding: 0;
    }
    .box {
      width: 10rem;
      height: 10rem;
      background-color: orange;
    }
  </style>
</head>

<body>
  <div class="box"></div>
</body>

</html>